package com.vvvtimes.demo.service;

import com.alibaba.fastjson.JSONObject;
import com.vvvtimes.demo.common.dto.RestResponse;
import com.vvvtimes.demo.domain.dto.IsoHashDTO;
import com.vvvtimes.demo.domain.vo.IsoHashVo;
import com.vvvtimes.demo.util.SoapClientManager;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;


@Slf4j
@Service
public class ValidateService {


    public RestResponse<IsoHashVo> isGenuineWindowsIso(IsoHashDTO isoHashDTO) {
        RestResponse<IsoHashVo> result=new RestResponse<>();
        String sha1 = isoHashDTO.getSha1();
        String execute = SoapClientManager.getInstance().execute("OnlineValidateV2", "sha1", sha1);
        if(StringUtils.isNoneEmpty(execute)){
            IsoHashVo isoHashVo = JSONObject.parseObject(execute, IsoHashVo.class);
            result.setResult(isoHashVo);
        }
        return result;
    }
}
